package com.yindian.cos.monitor.interceptor;

import com.yindian.cos.monitor.core.TrackerService;
import feign.RequestInterceptor;
import feign.RequestTemplate;

/**
 * 如果使用feign请注入此拦截器，会自动在heard中封装tracker_id
 *
 * @author zhangchuanhao
 * @create 2018/11/5 10:55
 */
public class TrackerFeignInterceptor implements RequestInterceptor {

    @Override
    public void apply(RequestTemplate template) {
        // 将当前trackerId放入请求头
        template.header(TrackerService.TRACKER_ID, TrackerService.getTrackerId());
    }
}
